import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CostEmployeeVO, CostEmployeeForm, CostEmployeeQuery } from '@/api/agriculture/costEmployee/types';

/**
 * 查询人工工时列表
 * @param query
 * @returns {*}
 */

export const listCostEmployee = (query?: CostEmployeeQuery): AxiosPromise<CostEmployeeVO[]> => {
  return request({
    url: '/agriculture/costEmployee/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询人工工时详细
 * @param costId
 */
export const getCostEmployee = (costId: string | number): AxiosPromise<CostEmployeeVO> => {
  return request({
    url: '/agriculture/costEmployee/' + costId,
    method: 'get'
  });
};

/**
 * 新增人工工时
 * @param data
 */
export const addCostEmployee = (data: CostEmployeeForm) => {
  return request({
    url: '/agriculture/costEmployee',
    method: 'post',
    data: data
  });
};

/**
 * 修改人工工时
 * @param data
 */
export const updateCostEmployee = (data: CostEmployeeForm) => {
  return request({
    url: '/agriculture/costEmployee',
    method: 'put',
    data: data
  });
};

/**
 * 删除人工工时
 * @param costId
 */
export const delCostEmployee = (costId: string | number | Array<string | number>) => {
  return request({
    url: '/agriculture/costEmployee/' + costId,
    method: 'delete'
  });
};
